﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SignalR;
using SignalR.Hubs;

namespace GameWeb.Hubs
{
    [HubName("turnnotification")]
    public class TurnNotificationHub : Hub, IDisconnect
    {
        public System.Threading.Tasks.Task Join(string gameId)
        {
            return Groups.Add(Context.ConnectionId, gameId);
        }
        public System.Threading.Tasks.Task Send(string gameId, string message)
        {
            return Clients[gameId].addMessage(message);
        }

        public System.Threading.Tasks.Task Disconnect(string gameId)
        {
            return Clients[gameId].leave(Context.ConnectionId);
        }

        public System.Threading.Tasks.Task Disconnect()
        {
            return null;
            //throw new NotImplementedException();
        }
    }
}